package ua.ck.example.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "providers")
public class Provider implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 677286717536634300L;
	@Id
	@GeneratedValue
	private Integer providerId;
	@Size(min = 3, max = 30)
	private String providerName;
	@NotNull
	@NotEmpty
	private String password;
	@NotNull
	@NotEmpty
	private String providerAdd;
	@Size(min = 10)
	private String providerTel;
	@NotNull
	@NotEmpty
	private String account;
	@NotEmpty
	@Email
	private String email;
	@OneToMany(fetch=FetchType.EAGER, mappedBy = "provider")
	private Set<Product> products = new HashSet<Product>(0);

	public Set<Product> getProducts() {
		return products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	// if in order,the related
	// method is
	// getICustomer,it will
	// be iCustomer

	public Integer getProviderId() {
		return providerId;
	}

	public void setProviderId(Integer providerId) {
		this.providerId = providerId;
	}

	public String getProviderName() {
		return providerName;
	}

	public void setProviderName(String providerName) {
		this.providerName = providerName;
	}

	public String getProviderAdd() {
		return providerAdd;
	}

	public void setProviderAdd(String providerAdd) {
		this.providerAdd = providerAdd;
	}

	public String getProviderTel() {
		return providerTel;
	}

	public void setProviderTel(String providerTel) {
		this.providerTel = providerTel;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

}
